package CollectionTest.Homework;

import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

/*
5.有2个数组，第一个数组内容为：[黑龙江省,浙江省,江西省,广东省,福建省]，
第二个数组为：[哈尔滨,杭州,南昌,广州,福州]，
将第一个数组元素作为key，第二个数组元素作为value存储到Map集合中。
如{黑龙江省=哈尔滨, 浙江省=杭州, …}
 */
public class Test5 {
    public static void main(String[] args) {
        String[] province = {"黑龙江省","浙江省","江西省","广东省","福建省"};
        String[] city = {"哈尔滨","杭州","南昌","广州","福州"};
        Properties p = new Properties();
        p.setProperty(province[0],city[0]);
        p.setProperty(province[1],city[1]);
        p.setProperty(province[2],city[2]);
        p.setProperty(province[4],city[4]);
        p.setProperty(province[3],city[3]);
        Set<Map.Entry<Object, Object>> s = p.entrySet();
        for(Map.Entry<Object,Object> o : s){
            System.out.println(o.getKey()+"="+o.getValue());
        }
        System.out.println("================");
        Set<Map.Entry<Object, Object>> s1 = p.entrySet();
        Iterator<Map.Entry<Object, Object>> i = s1.iterator();
        while(i.hasNext()){
            System.out.println(i.next());
        }
    }
}
